<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String mainid = request.getParameter("mainid");
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> 
<html xmlns="http://www.w3.org/1999/xhtml">
  <head> 							
		<%@ include file="../jslib/jquerylib.jsp" %>
	   		
	  <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jqGrid/css/jqgrid.css"></link>
	  <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/lhgdialog/lhgcore.lhgdialog.min.js?skin=mac"></script>
	  <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/My97DatePicker/WdatePicker.js" defer="defer"></script>
      <link href="<%=request.getContextPath() %>/web/style/layout.css" type="text/css" rel="stylesheet"/>
     <link rel="stylesheet" href="<%=request.getContextPath() %>/jslib/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css"/>
     <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/ztree/jquery.ztree.core-3.4.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/demo.css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
	       <!-- 删除结果信息返回 -->
	    	<c:if test="${requestScope.message!=null}">
				<script type="text/javascript">
	  	 		     alert('<c:out value="${requestScope.message}"></c:out>');
	  	 		     window.close();
	  			</script>
	        </c:if>
	
    <script type="text/javascript">
     var api = frameElement.api, W = api.opener;
     var ids = '${ids}';
    
    $(document).ready(function(){
    	var lastrow=0;
    	var lastcell=0;
    	$("#gridTableSample").jqGrid({
        	url:'<%=request.getContextPath() %>/equipmentParts!queryEquRelationByID.action?ids='+ids,
			datatype: "json",
			height: 150,
			width: 720, 
			autowidth: true, 
			colNames:['序号','备件代码','备件名称','规格型号','平均价格','出库数量'],
			colModel:[
					{name:'id',index:'id', width:100, key:true,hidden:true,hidedlg:true}, 				
					{name:'epCode',index:'epCode', width:150},	
					{name:'epName',index:'epName', width:150},								
					{name:'epGuige',index:'epGuige', width:150},
					{name:'epAverageprice',index:'epAverageprice', width:60},
					{name:'epoutNum',index:'epoutNum',width:100},	
			],
			shrinkToFit:false,
			sortname:'epCode',
			sortorder:'desc',
			viewrecords:true,
			//multiselect: true, // 是否显示复选框
			multiboxonly : true, 
			rownumbers: true,//显示行号
			rownumWidth: 30, //行号的宽度
			rowNum:15,
			rowList:[15,20,50,400,510],
			toolbar: [false,"top"],
			beforeEditCell:function(rowid,cellname,v,iRow,iCol){
				lastrow = iRow;
				lastcell = iCol;
			},
			jsonReader: {
				root:"rows",		// 数据行（默认为：rows）
				page: "page",  	// 当前页
				total: "total",  // 总页数
				records: "records",  // 总记录数
				repeatitems:false		// 设置成false，在后台设置值的时候，可以乱序。且并非每个值都得设
			},
			prmNames:{rows:"rows",page:"page",sort:"sidx",order:"sord",search:"search"},
			pager:"#gridPagerSample",
			caption: "设备备件台账",
			cellEdit:true,
			cellsubmit:'clientArray', 
		});
		//下面是提交表单代码
    	var actionUrl = '<%=request.getContextPath()%>/equipmentpartsout!responPersonSubmit.action';
		var options = {
	  	    url:actionUrl,
	  	     beforeSubmit: function() {
	   				//return checking();
	    			},
	  	    dataType:'json',
	  	    success: function(data) {	  	    
	  	      if(data.result=='success'){
				alert("提交成功");		
				api.close();
				W.reload();
	  	      }
	  	    }};
    	$('#saveBtn').click(function(){
    		$('#pageFrom').ajaxSubmit(options);
	            return false;
		});
		$('#closeBtn').click(function(){
			api.close();
		});

	  	function checking(){
	   		var flag = true;
			var FormSerial = $("#outFormSerial").val();
			var OutType = $("#OutType").val();
			var applyDept = $("#applyDept").val();					
			if(FormSerial ==null || FormSerial == "" ){
				alert("审核人不能为空！");
				$("#outFormSerial").focus();
	    		return false;
			}				
		}          	
});  		
   </script>
 	<style type="text/css">
 		body{
 			background:#ffffff; background-image:url(images/);
 		}
   		html{
		    overflow-x: hidden;
			overflow-y: hidden;
		}  	
		.formTableNew textarea{border: 1px solid #999;padding: 5px;width: 760px;-moz-border-radius: 3px;border-radius: 3px;margin-bottom: 5px;color: #666;background: url(../images/input_bg.gif) repeat-x top;}
   </style>
  </head>
  
 <body>
<form id="pageFrom" action="" enctype="multipart/form-data" method="post">
        <input type="hidden" id="flag" name="flag" />
        <input type="hidden" name="flowid" id="flowid" value="${flowid}">
     	<input type="hidden" name="stateid" id="stateid" value="${stateid}">
     	<input type="hidden" name="mainid" id="mainid" value="${mainid}"> 	
     	<input type="hidden" name="taskinfoid" id="taskinfoid" value="${taskinfoid}">
     	${steptcontent}
  		<table width="100%" border="0" align="center" cellpadding="1px" cellspacing="1px" class="formTableNew">
  			
  		 <tr>			   
  			    <td align="right">流程名称：</td>
  			    <td align="left">
  			    <input  type="text"  id="flowname" maxlength="50" name="flowname" value = "${flowname}" style="border: 1px solid #999;padding: 5px;width: 250px;" readonly="readonly"/>
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			    </td>
  			
  			  <td align="right">出库单号：</td>
  			  <td align="left">
  			    <input  type="text" id="outFormSerial" maxlength="50" name="outstoreform.formserial" value = "${formSerial}"style="border: 1px solid #999;padding: 5px;width: 250px" readonly="readonly"/>
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td> 			 
  		 </tr>
  		<tr>   
  			  <td align="right">申请部门：</td>
  			  <td align="left">
  			    <input  type="text" id="applyDept" maxlength="50" name="outstoreform.applydept" value ="${applyDept}" style="border: 1px solid #999;padding: 5px;width: 250px"  value="${applyDep}" readonly="readonly"/>
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			  
  			  
  			   <td align="right">出库类型：</td>
  			   <td align="left">
  			    <select id="OutType" name="outstoreform.outtype"  readonly="readonly"/>
  			        <option>${outType}</option>
  			       <!--   <option>维保</option>
  			        <option>改造</option>
  			        <option>借用</option>
  			        <option>报废</option>
  			        <option>其他</option>-->
  			    </select>
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			   </td>
  		</tr>
  			 <tr>  
  			   <td align="right">申请日期：</td>
  			   <td align="left">
  			  	 <input  type="text" id="gongyingpinname" maxlength="50" name="outstoreform.applydate" value= "${applyData}" style="border: 1px solid #999;padding: 5px;width: 250px" readonly="readonly"/>
  			  	 <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			 </td>
  			  
             <td align="right">申请人：</td>
  			   <td align="left">
  			    <input  type="text" id="lianxiren" maxlength="50" name="outstoreform.applyperson" style="border: 1px solid #999;padding: 5px;width: 250px"  value="${applyPerson}" readonly="readonly"/>
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td> 			   
  			</tr>
  			
  			<tr>
  			  			   
  			  <td align="right">出库原因：</td>
  			  <td align="left">
  			    <input  type="text"  id="chukuyuanyin" maxlength="50"  name="outstoreform.reasonforout" style="border: 1px solid #999;padding: 5px;width: 250px;" value ="${outReason }" readonly="readonly"/>
  			  </td> 
  			  
  			    			   
  			   <td align="right">备注：</td>
  			  <td align="left">
  			    <input  type="text"  id="beizhu" maxlength="50"  name="outstoreform.remarks" style="border: 1px solid #999;padding: 5px;width: 250px;" value ="${remarks}" readonly="readonly"/>
  			  </td> 
  			  
  			</tr> 												
  			 <!-- 备件列表 -->
  			<tr>
			<td colspan='4' align='center'>
			<div id='tt1' class='easyui-tabs' style='width:750px;height：600px'>
			<div title='备         件 ' style='padding:10px'>
				<table id="gridTableSample"></table>
				<div id=gridPagerSample></div></div>
			</td>
		   </tr>  
		</table>
		
		<table width="100%" border="0" align="center" class="formTableNew" cellpadding="5" cellspacing="5" >
		  <tr>
		    <td align ="right">负责部门科长审批:</td>
			<td align="left">
		    	<input  type="text"  id="leadername" maxlength="50"  name="aleadonename" style="border: 1px solid #999;padding: 5px;width: 250px;" value ="${AuditPerson }"/>
		    </td>
		    <td align = "right">批准时间：</td>
		    <td align="left">
		      <input  type="text" id="aleadonetime" maxlength="50" name="leadertime"  onClick="WdatePicker()" style="border: 1px solid #999;padding: 5px;width: 250px" value ="${timeStr}"/> 			  	 
		    </td>
		  </tr>	
		  <tr>
			  <td align="right">审核意见：</td>
		         <td colspan="3" align="left">
		         <textarea  rows="3" cols="3" class='ftextarea' id="leadersuggestion" name="leadersuggestion" ></textarea>
		     </td>
		 </tr>
		</table>
		
		
		<table width="100%" border="0" align="center" class="formTableNew">
		  <tr>
			<td align="center">
		    	<input id="saveBtn" type="button" value="提 交" class="form_bt_orange"  />
		    	<input type="button" id="closeBtn" value="取 消" class="form_bt_grey" />
		    </td>
		  </tr>		  
		</table>
	<!--表单结束-->
	</form>
  </body>
</html>
